package com;

import com.spring.TylerApplicationContext;
import com.tyler.config.AppConfig;
import com.tyler.service.OrderService;
import com.tyler.service.UserInterface;
import com.tyler.service.UserService;

public class Main {

    public static void main(String[] args) {
        // 单例与多例的比较
        /*TylerApplicationContext applicationContext = new TylerApplicationContext(AppConfig.class);
        UserService userService = (UserService) applicationContext.getBean("userService");
        UserService userService2 = (UserService) applicationContext.getBean("userService");
        System.out.println(userService);
        System.out.println(userService2);*/

        // 依赖注入测试
        /*TylerApplicationContext applicationContext = new TylerApplicationContext(AppConfig.class);
        UserService userService = (UserService) applicationContext.getBean("userService");
        userService.test();*/

        // AOP切面测试
        TylerApplicationContext applicationContext = new TylerApplicationContext(AppConfig.class);
        UserInterface userService = (UserInterface) applicationContext.getBean("userService");
        userService.test();
    }
}